var http = require("http");
var querystring = require("querystring");

http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/html'});
    console.log(req.method);
    if(req.method == 'GET'){
        res.end("GET:" + req.method);
    }else{
        var data = "";
        req.addListener("data", function(chunkData){
            data += chunkData;
        });
        req.addListener("end", function(){
            console.log(querystring.parse(data));
	    console.log(data);
            res.end("POST:" + req.method);
        });
    }
}).listen(3000);
